package com.example.demo.config.datasource;

/**
 * @author: wuhong-016
 * @time: 2021/3/5 9:21
 * @version: v1.0.0
 * @description:
 * 动态数据源上下文
 */
public class DynamicDataSourceHolder {

    private static final ThreadLocal<String> CONTEXT_HOLDER = new ThreadLocal<>();

    public static void set(String name) {
        CONTEXT_HOLDER.set(name);
    }

    public static void clear() {
        CONTEXT_HOLDER.remove();
    }

    public static String get() {
        return CONTEXT_HOLDER.get();
    }

}
